#include "main/utils.h"
using namespace std;

int numberOfInteger2String(int integer) {
  if (integer < 0) {
    return 0;
  }
  string str = to_string(integer);
  int length = str.size();
  if (length == 1) {
    return 1;
  }
  int last_two_count = 1;
  int last_one_count = 0;
  char last_one_str = '\0';
  if (length >= 2) {
    last_one_str = str[1];
    auto tmp_integer = (str[0] - '0') * 10 + str[1] - '0'; 
    if (tmp_integer >= 10 && tmp_integer <= 25) {
      last_one_count = 2;
    } else {
      last_one_count = 1;
    }
  }
  int cur_count = last_one_count;
  char cur_str = str[1];
  for (int i = 2; i < length; ++i) {
    cur_str = str[i];
    auto tmp_integer = (last_one_str - '0') * 10 + cur_str - '0';
    if (tmp_integer >= 10 && tmp_integer <= 25) {
      cur_count = last_one_count + last_two_count;
    } else {
      cur_count = last_one_count;
    }
    last_two_count = last_one_count;
    last_one_count = cur_count;
    last_one_str = cur_str;
  }
  return cur_count;
}

int main() {
  int ret = numberOfInteger2String(12258);
  cout << "The number of integer to string: " << ret << endl;

  return 0;
}
